package com.crazyread.dao;



import com.crazyread.model.domain.UserAuthority;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserAuthorityMapper {


    //通过用户id获取用户权限信息
    @Select("SELECT * FROM user_authority WHERE user_id=#{userId}")
    public UserAuthority getUserAuthority(Long id);

    //注册用户为用户添加权限  默认为普通用户
    @Insert("INSERT INTO user_authority (user_id,authority_id) VALUES (#{userId},#{authorityId})")
    public void addUserAuthority(UserAuthority userAuthority);

    //删除用户中间表对应信息权限
    @Delete("delete from user_authority where user_id=#{userId}")
    public void delUserAuthority(Integer userId);
}
